//
//  MHCommonRightButtonCell.m
//  MiaoCircle
//
//  Created by 许正荣 on 2018/6/26.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHCommonRightButtonCell.h"


@implementation MHCommonRightButtonCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        // 初始化
//        [self _setup];
        
        // 创建自控制器
        [self setupSubViews];
        
        // 布局子控件
        [self _makeSubViewsConstraints];
    }
    return self;
}

-(void) _setup
{
    
}

-(void) setupSubViews
{
    UIButton *button = [UIButton new];
    button.titleLabel.font = MHRegularFont_16;
    button.layer.cornerRadius = 5;
    button.layer.masksToBounds = YES;
    
    [button setBackgroundImage:[UIImage imageWithColor:MHColorFromHexString(@"#fe313d")] forState:0];
    [button setBackgroundImage:[UIImage imageWithColor:MHSpliteLineColor] forState:UIControlStateDisabled];
//    button.titleLabel
    [button setTitleColor:MHAlertTextColor forState:UIControlStateDisabled];
    
    [button setTitleColor:MHWhiteTextColor forState:0];
    [self addSubview:button];
    self.rightButton = button;
    
}

+ (instancetype)cellWithTableView:(UITableView *)tableView style:(UITableViewCellStyle)style{
    static NSString *ID = @"MHCommonRightButtonCell";
    MHCommonRightButtonCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[self alloc] initWithStyle:style reuseIdentifier:ID];
    }
    return cell;
}



//-(void)bindViewModel:(MHSetPriceItemViewModel *)viewModel
//{
//    [super bindViewModel:viewModel];
//    self.viewModel.price = self.priceTextFeild.text;
//    //    RAC(self.viewModel , price) = [RACSignal merge:@[RACObserve(self.priceTextFeild, text),self.priceTextFeild.rac_textSignal]];
//
//}


-(void) _makeSubViewsConstraints
{
    
}


-(void)bindViewModel:(id)viewModel
{
    [super bindViewModel:viewModel];
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.rightButton.mh_right = MH_SCREEN_WIDTH - 20;
    self.rightButton.mh_width = 50;
    self.rightButton.mh_height = 25;
    self.rightButton.centerY = self.mh_height * .5f;
    self.rightButton.titleLabel.font = MHRegularFont_13;
}
@end
